package com.hwhhhh.mygrad;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import com.hwhhhh.mygrad.adapter.ShoppingAdapter;
import com.hwhhhh.mygrad.decoration.GridSpacingItemDecoration;
import com.hwhhhh.mygrad.utils.StringUtils;

public class ShoppingActivity extends BaseActivity {
    private RecyclerView rvShopping;

    @Override
    protected void initView() {
        rvShopping = findViewById(R.id.rv_shopping);
    }

    @Override
    protected int initLayout() {
        return R.layout.activity_shopping;
    }

    @Override
    protected void initData() {
        ShoppingAdapter adapter = new ShoppingAdapter();
        GridLayoutManager layoutManager = new GridLayoutManager(this, 2);
        GridSpacingItemDecoration decoration = new GridSpacingItemDecoration(this, 2, 8, false, 0);
        rvShopping.setAdapter(adapter);
        rvShopping.addItemDecoration(decoration);
        rvShopping.setLayoutManager(layoutManager);
    }
}